package com.ygswglxt.attendance.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ygswglxt.attendance.entity.AttendanceSupplement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AttendanceSupplementMapper extends BaseMapper<AttendanceSupplement> {
    
    /**
     * 获取待审批的补卡申请（联表查询员工名称）
     */
    @Select("SELECT asup.*, COALESCE(u.name, u.username) as userName " +
            "FROM attendance_supplement asup " +
            "LEFT JOIN sys_user u ON asup.user_id = u.id " +
            "WHERE asup.status = 'PENDING' " +
            "ORDER BY asup.create_time DESC")
    List<AttendanceSupplement> selectPendingWithUserName();
}

